package com.bwhx.eruler.bean.casdilly;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;

public class CasdillyCustomer extends BaseBean {
	String customerID;
	String contractID; // 因为当初设计时候没设计分场，所以这个原来是用来存项目id的字段用来存分场id了
	Integer customerNewFlag;
	String customerName;
	Integer customerSex;
	String customerAge;
	String customerTel;
	String customerCom;
	String customerDep;
	String customerDuty;
	String customerClothLike;
	String customerBodyType;
	String customerBeiZhu;
	String customerIndex;
	String cPhotoZM;
	String cPhotoCM;
	String cPhotoBM;
	String cPhotoQM;
	String customerClass;
	String cMeasureState;
	String v_fenchang;
	String CreatorID;//前端上传数据了，所以这个字段是判断哪些用户是量体师量的
	String v_creatorName;
	String isdel;

	Integer start_index;
	Integer end_index;

	Date cUploadTime;
	Integer cUploadState;
	String bmiTest;

	private String deleterID;
	private Date deleteTime;

	List<CasdillyScanData> scandata;

	// 增加用户同步测量数据
	List<HashMap<String, Object>> userScanData;

	String hetongSerial;

	Integer exportstatus;

	private String exporterID;
	private Date exportTime;

	private String qRCodeURL;
	private Date qRCodeURLCreateTime;
	private String wxOpenID;

	private String uploaderID;
	private String v_uploaderName;

	private String v_pinleimingStr;

	private String customerChildDep;

	private String customerPost;

	private String customerGroup;

	public List<HashMap<String, Object>> getUserScanData() {
		return userScanData;
	}

	public void setUserScanData(List<HashMap<String, Object>> userScanData) {
		this.userScanData = userScanData;
	}

	public String getIsdel() {
		return isdel;
	}

	public void setIsdel(String isdel) {
		this.isdel = isdel;
	}

	public String getDeleterID() {
		return deleterID;
	}

	public void setDeleterID(String deleterID) {
		this.deleterID = deleterID;
	}

	public Date getDeleteTime() {
		return deleteTime;
	}

	public void setDeleteTime(Date deleteTime) {
		this.deleteTime = deleteTime;
	}

	public String getV_pinleimingStr() {
		return v_pinleimingStr;
	}

	public void setV_pinleimingStr(String v_pinleimingStr) {
		this.v_pinleimingStr = v_pinleimingStr;
	}

	public String getV_uploaderName() {
		return v_uploaderName;
	}

	public void setV_uploaderName(String v_uploaderName) {
		this.v_uploaderName = v_uploaderName;
	}

	public String getUploaderID() {
		return uploaderID;
	}

	public void setUploaderID(String uploaderID) {
		this.uploaderID = uploaderID;
	}

	public String getWxOpenID() {
		return wxOpenID;
	}

	public void setWxOpenID(String wxOpenID) {
		this.wxOpenID = wxOpenID;
	}

	public String getqRCodeURL() {
		return qRCodeURL;
	}

	public void setqRCodeURL(String qRCodeURL) {
		this.qRCodeURL = qRCodeURL;
	}

	public Date getqRCodeURLCreateTime() {
		return qRCodeURLCreateTime;
	}

	public void setqRCodeURLCreateTime(Date qRCodeURLCreateTime) {
		this.qRCodeURLCreateTime = qRCodeURLCreateTime;
	}

	public String getExporterID() {
		return exporterID;
	}

	public void setExporterID(String exporterID) {
		this.exporterID = exporterID;
	}

	public Date getExportTime() {
		return exportTime;
	}

	public void setExportTime(Date exportTime) {
		this.exportTime = exportTime;
	}

	public Integer getExportstatus() {
		return exportstatus;
	}

	public void setExportstatus(Integer exportstatus) {
		this.exportstatus = exportstatus;
	}

	public Integer getStart_index() {
		return start_index;
	}

	public void setStart_index(Integer start_index) {
		this.start_index = start_index;
	}

	public Integer getEnd_index() {
		return end_index;
	}

	public void setEnd_index(Integer end_index) {
		this.end_index = end_index;
	}

	public String getBmiTest() {
		return bmiTest;
	}

	public void setBmiTest(String bmiTest) {
		this.bmiTest = bmiTest;
	}

	public String getHetongSerial() {
		return hetongSerial;
	}

	public void setHetongSerial(String hetongSerial) {
		this.hetongSerial = hetongSerial;
	}

	public List<CasdillyScanData> getScandata() {
		return scandata;
	}

	public void setScandata(List<CasdillyScanData> scandata) {
		if (scandata != null && scandata.size() > 0) {
			for (int i = 0; i < scandata.size(); i++) {
				if (!clothesSize.containsKey(scandata.get(i).getCategory())) {
					clothesSize.put(scandata.get(i).getCategory(), new HashMap<String, String>());
				}
				if (scandata.get(i).getTypename().contains("号型")){
					if (scandata.get(i).getShuzhi() != null && !scandata.get(i).getShuzhi().isEmpty()) {
						clothesSize.get(scandata.get(i).getCategory()).put("号型", scandata.get(i).getShuzhi());
					}
				} else {
					if (scandata.get(i).getShuzhi() != null && !scandata.get(i).getShuzhi().isEmpty()) {
						clothesSize.get(scandata.get(i).getCategory()).put(scandata.get(i).getTypename(),
								scandata.get(i).getShuzhi());
					}
				}
			}
		}
		this.scandata = scandata;
	}

	public CasdillyCustomer() {
		super();
	}

	// [编号, 单位, 部门,分部门,岗位,班组, 姓名, 性别, 职务, 电话, 年龄, 备注]
	public CasdillyCustomer(String customerIndex, String customerCom, String customerDep, String customerChildDep,
			String customerPost, String customerGroup, String customerName, Integer customerSex, String customerDuty,
			String customerTel, String customerAge, String customerBeiZhu) {
		super();
		this.customerChildDep = customerChildDep;
		this.customerPost = customerGroup;
		this.customerGroup = customerPost;
		this.customerName = customerName;
		this.customerSex = customerSex;
		this.customerAge = customerAge;
		this.customerTel = customerTel;
		this.customerCom = customerCom;
		this.customerDep = customerDep;
		this.customerDuty = customerDuty;
		this.customerBeiZhu = customerBeiZhu;
		this.customerIndex = customerIndex;
	}

	public String getV_fenchang() {
		return v_fenchang;
	}

	public void setV_fenchang(String v_fenchang) {
		this.v_fenchang = v_fenchang;
	}

	public String getV_creatorName() {
		return v_creatorName;
	}

	public void setV_creatorName(String v_creatorName) {
		this.v_creatorName = v_creatorName;
	}

	public String getCustomerID() {
		return customerID;
	}

	public void setCustomerID(String customerID) {
		this.customerID = customerID;
	}

	public String getContractID() {
		return contractID;
	}

	public void setContractID(String contractID) {
		this.contractID = contractID;
	}

	public Integer getCustomerNewFlag() {
		return customerNewFlag;
	}

	public void setCustomerNewFlag(Integer customerNewFlag) {
		this.customerNewFlag = customerNewFlag;
	}

	public String getCustomerName() {
		return customerName;
	}

	public void setCustomerName(String customerName) {
		this.customerName = customerName;
	}

	public Integer getCustomerSex() {
		return customerSex;
	}

	public void setCustomerSex(Integer customerSex) {
		this.customerSex = customerSex;
	}

	public String getCustomerAge() {
		return customerAge;
	}

	public void setCustomerAge(String customerAge) {
		this.customerAge = customerAge;
	}

	public String getCustomerTel() {
		return customerTel;
	}

	public void setCustomerTel(String customerTel) {
		this.customerTel = customerTel;
	}

	public String getCustomerCom() {
		return customerCom;
	}

	public void setCustomerCom(String customerCom) {
		this.customerCom = customerCom;
	}

	public String getCustomerDep() {
		return customerDep;
	}

	public void setCustomerDep(String customerDep) {
		this.customerDep = customerDep;
	}

	public String getCustomerDuty() {
		return customerDuty;
	}

	public void setCustomerDuty(String customerDuty) {
		this.customerDuty = customerDuty;
	}

	public String getCustomerClothLike() {
		return customerClothLike;
	}

	public void setCustomerClothLike(String customerClothLike) {
		this.customerClothLike = customerClothLike;
	}

	public String getCustomerBodyType() {
		return customerBodyType;
	}

	public void setCustomerBodyType(String customerBodyType) {
		this.customerBodyType = customerBodyType;
	}

	public String getCustomerBeiZhu() {
		return customerBeiZhu;
	}

	public void setCustomerBeiZhu(String customerBeiZhu) {
		this.customerBeiZhu = customerBeiZhu;
	}

	public String getCustomerIndex() {
		return customerIndex;
	}

	public void setCustomerIndex(String customerIndex) {
		this.customerIndex = customerIndex;
	}

	public String getcPhotoZM() {
		return cPhotoZM;
	}

	public void setcPhotoZM(String cPhotoZM) {
		this.cPhotoZM = cPhotoZM;
	}

	public String getcPhotoCM() {
		return cPhotoCM;
	}

	public void setcPhotoCM(String cPhotoCM) {
		this.cPhotoCM = cPhotoCM;
	}

	public String getcPhotoBM() {
		return cPhotoBM;
	}

	public void setcPhotoBM(String cPhotoBM) {
		this.cPhotoBM = cPhotoBM;
	}

	public String getcPhotoQM() {
		return cPhotoQM;
	}

	public void setcPhotoQM(String cPhotoQM) {
		this.cPhotoQM = cPhotoQM;
	}

	public String getCustomerClass() {
		return customerClass;
	}

	public void setCustomerClass(String customerClass) {
		this.customerClass = customerClass;
	}

	public String getcMeasureState() {
		return cMeasureState;
	}

	public void setcMeasureState(String cMeasureState) {
		this.cMeasureState = cMeasureState;
	}

	public Date getcUploadTime() {
		return cUploadTime;
	}

	public void setcUploadTime(Date cUploadTime) {
		this.cUploadTime = cUploadTime;
	}

	public Integer getcUploadState() {
		return cUploadState;
	}

	public void setcUploadState(Integer cUploadState) {
		this.cUploadState = cUploadState;
	}

	public String getCustomerChildDep() {
		return customerChildDep;
	}

	public void setCustomerChildDep(String customerChildDep) {
		this.customerChildDep = customerChildDep;
	}

	public String getCustomerPost() {
		return customerPost;
	}

	public void setCustomerPost(String customerPost) {
		this.customerPost = customerPost;
	}

	public String getCustomerGroup() {
		return customerGroup;
	}

	public void setCustomerGroup(String customerGroup) {
		this.customerGroup = customerGroup;
	}

	public static String typeName = "";

	private HashMap<String, HashMap<String, String>> clothesSize = new HashMap<String, HashMap<String, String>>();

	public String getClothesSize() {
		String str = "";
		if (clothesSize.containsKey(typeName) && clothesSize.get(typeName).containsKey("号型")) {
			str = clothesSize.get(typeName).get("号型");
		}
		return str;
	}

	public void setClothesSize(String clothesSize) {

	}

	/**
	 * 根据号型排序
	 * 
	 * @param customerList
	 *            包含号型数据的用户信息
	 * @return
	 */

	public static CasdillyCustomer[] OrderByCloseSize(List<CasdillyCustomer> customerList) {
		// Collections.sort(customerList,(CasdillyCustomer a,CasdillyCustomer b) ->
		// a.getClothesSize().compareTo(b.getClothesSize()));
		CasdillyCustomer[] array = new CasdillyCustomer[customerList.size()];
		if (customerList != null && customerList.size() > 0) {
			String str1 = "", str2 = "";
			array = customerList.toArray(array);
			CasdillyCustomer temp = null;
			for (int i = 0; i < array.length; i++) {
				for (int j = i + 1; j < array.length; j++) {
					str1 = array[i].getClothesSize();
					str2 = array[j].getClothesSize();
					if (str1.compareTo(str2) > 0) { // 对象排序用camparTo方法
						temp = array[i];
						array[i] = array[j];
						array[j] = temp;
					}
					str1 = null;
					str2 = null;
				}
			}
		}
		return array;
	}

	/**
	 * 获取量体部位的值
	 * 
	 * @param typeName
	 *            品类名称
	 * @param bodyPartName
	 *            量体部位名称
	 * @return
	 */
	public String getBodyPartValue(String typeName, String bodyPartName) {
		String desc = "";
		if (this.clothesSize != null && this.clothesSize.containsKey(typeName) && this.clothesSize.get(typeName).containsKey(bodyPartName)) {
			desc = this.clothesSize.get(typeName).get(bodyPartName);
		}
		return desc;
	}
}
